home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: What is &Variable (declared as: char Variable[10])?
- Date: 28 Feb 1996 21:56:31 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb28145631@qcd.lanl.gov>
- References: <4gqpa1$3h9@alcor.usc.edu> <4gsdno$1bg@umbc9.umbc.edu>
- <4gtab6$acb@ceylon.gte.com> <313318b8.53776146@nntp.ix.netcom.com>
- <4h1u9d$sqq@ceylon.gte.com>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Brenda's message of 28 Feb 1996 16:01:48 GMT
-
- In article <4h1u9d$sqq@ceylon.gte.com>
- Brenda <g051286> writes:
-
- <snip>
- B: What is the definition of a pointer? I have always been taught that a
-
- pointer is a cetgory of types. An array does not belong to this
- category.
-
- B: pointer is simply an address in memory, and an array name (i.e. myarray)
- B: is simply a CONSTANT address. I don't think this statement is all that
-
- You have always been taught wrong in that case. Just like after `int
- i;', i is not a constant address but the designator of a region of
- memory, after `int j[5];', j is a designator of another region of
- memory.
-
- B: radical. Of course there are differences between arrays and pointers
-
- I agree it is not a radical mistake: it is a mistake which is often
- made. What we hope would some day be radical is for people like you to
- post without reading the FAQ which explains this and many other issues.
-
- B: due to the fact that an array is a CONSTANT address and a pointer is a
- B: VARIABLE address. And the reason I said you shouldn't (note shouldn't
-
- The problem is much more serious. An array is not an address in any
- sense, constant or not.
-
- B: not couldn't) say &myarray is:
- B:
- B: ==================================================
- B: (from "A Book On C", Kelley & Pohl, pg 200)
- B: Constructs not to be pointed at:
- B: 1. Do not point at constants. (&3)
- B: 2. Do not point at arrays; an array name is a constant. (int a[77]; &a)
-
- This statement is incorrect. &a is perfectly valid C. C is currently
- defined by an international standards doucment, and that clearly
- allows address of arrays. Please do not try to argue from completely
- outdated or mistaken books.
-
- B: 3. Do not point at ordinary expressions &(k + 99)
- B: 4. Do not point at register variables. (register v; &v)
- B: The address operator can be applied to variables and array elements.
-
- And to functions, non-bitfield struct or union members, and arrays.
-
- B: ===================================================
- B:
- B: So again I say, myarray is DEFINITELY a pointer (i.e. address in memory).
- B:
-
- And you will be wrong again. Please learn C as it is today, and has
- been for quite a while now, before posting further.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-